package practice;

/**
 * @Auther Jun jie Yi
 * @Date 16:42 2022/2/9
 */
public class LeetCode9 {

    public static void main(String[] args) {
        boolean palindrome = isPalindrome(-121);
        System.out.println(palindrome);
    }

    public static boolean isPalindrome(int x) {
        if (x < 0) return false;
        int n = 0, t = x;
        while (t != 0) {
            n = n * 10 + t % 10;
            t = t / 10;
        }
        return x == n ? true : false;
    }
}
